<?php // Définitions
    $JOURS = array('Lundi','Mardi','Mercredi','Jeudi','Vendredi','Samedi');
?>

<div class="planning-heures">
    <div class="planning-titre">&nbsp;</div>
    <div class="heure">8h30</div>
    <?php for($i=9; $i<20; $i++): ?>
	<div class="demi-heure"><?php echo $i ?>h</div>
	<div class="heure"><?php echo $i ?>h30</div>
    <?php endfor; ?>
    <div class="demi-heure">20h</div>
</div>

<?php 
    for ($i=0; $i<sizeof($JOURS); $i++):
    $dateJour = $date->jourDeLaSemaine($i);
    $desactived = false;
	foreach ($seances AS $id_promotion=>$seancesPromotion): 
	    if ( (isset($seancesPromotion[$dateJour->toURL()])) AND ($seancesPromotion[$dateJour->toURL()] === false) ):
		$desactived = true;
	    endif;
	endforeach;
    ?>
    <div class="planning-jour<?php if($desactived): ?> desactived<?php elseif ($dateJour->toURL()==Date::today()->toURL()): ?> selected<?php endif; ?>" name="<?php echo $i ?>" <?php if ($i>=sizeof($JOURS)-1):?> style="border-right:0;"<?php endif; ?>>

    <div class="planning-titre" name="<?php echo $dateJour->toURL() ?>"><?php echo $JOURS[$i]; ?> <?php echo $dateJour->format('j F') ?></div>
	<div name="relative" style="position:relative;">
	<?php for($j=8; $j<20; $j++): ?>
	    <div class="heure"></div>
	    <div class="demi-heure"></div>
	<?php endfor; ?>

	<?php if ( !empty($seances) ):
	    foreach ($seances AS $id_promotion=>$seancesPromotion):
		if (!empty($seancesPromotion[$dateJour->toURL()]) ):
		    foreach ($seancesPromotion[$dateJour->toURL()] AS $seance):
			$seance->display();
		    endforeach;
		endif;
	    endforeach;
    endif; ?>
    	</div>
    </div>
<?php endfor; ?>